//
//  CalendarMonthView.h
//  BBT
//
//  Created by JoyWang on 14-7-11.
//  Copyright (c) 2014年 tiewang. All rights reserved.
//

#import <UIKit/UIKit.h>
#define VIEW_WIDTH  CGRectGetHeight([[UIScreen mainScreen] bounds])/2
#define VIEW_HEIGHT 270
#define DOT_FONT_SIZE 10.0f
#define DATE_FONT_SIZE 14.0f
@protocol CalendarMonthViewDelegate, CalendarMonthViewDataSource;
@interface CalendarMonthView : UIView

/**
 *  Initialize a Calendar Month Gird
 *
 *  @param sunday  周日是否在最左边
 *  @param timeZone 时区
 *
 *  @return 返回“CalendarMonthView” or nil
 */
- (instancetype) initWithSundayAsFirst:(BOOL)sunday timeZone:(NSTimeZone*)timeZone;

@property (nonatomic,strong)NSTimeZone *timeZone;
@property (nonatomic)BOOL sunday;

@property (nonatomic,assign) id <CalendarMonthViewDataSource> dataSource;
/** The delegate must adopt the `CalendarMonthViewDelegate` protocol. The delegate is not retained. */
@property (nonatomic,assign) id <CalendarMonthViewDelegate> delegate;

@end

#pragma mark - CalendarMonthViewDelegate
/** The delegate of a `CalendarMonthView` object must adopt the `CalendarMonthViewDelegate` protocol. */
@protocol CalendarMonthViewDelegate <NSObject>
@optional

/** The highlighed date changed.
 @param monthView The calendar month view.
 @param date The highlighted date.
 */
- (void) calendarMonthView:(CalendarMonthView*)monthView didSelectDate:(NSDate*)date;


/** The calendar should change the current month to grid shown.
 @param monthView The calendar month view.
 @param month The month date.
 @param animated Animation flag
 @return YES if the month should change. NO otherwise
 */
- (BOOL) calendarMonthView:(CalendarMonthView*)monthView monthShouldChange:(NSDate*)month animated:(BOOL)animated;

/** The calendar will change the current month to grid shown.
 @param monthView The calendar month view.
 @param month The month date.
 @param animated Animation flag
 */
- (void) calendarMonthView:(CalendarMonthView*)monthView monthWillChange:(NSDate*)month animated:(BOOL)animated;

/** The calendar did change the current month to grid shown.
 @param monthView The calendar month view.
 @param month The month date.
 @param animated Animation flag
 */
- (void) calendarMonthView:(CalendarMonthView*)monthView monthDidChange:(NSDate*)month animated:(BOOL)animated;
@end

#pragma mark - CalendarMonthViewDataSource
/** The data source of a `CalendarMonthView` object must adopt the `CalendarMonthViewDataSource` protocol. */
@protocol CalendarMonthViewDataSource <NSObject>

/** A data source that will correspond to marks for the calendar month grid for a particular month.
 @param monthView The calendar month grid.
 @param startDate The first date shown by the calendar month grid.
 @param lastDate The last date shown by the calendar month grid.
 @return Returns an array of NSNumber objects corresponding the number of days specified in the start and last day parameters. Each NSNumber variable will give a BOOL value that will be used to display a dot under the day.
 */
- (NSArray*) calendarMonthView:(CalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate;
@end
